﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchemaMonitor.json.dict
{
    public class CToken : CDict
    {
        //Members
        public string AccessToken;
        public int    ExpiresInSecs;
        public string MachineId;
        public DateTime Expires;

        //Constructor
        public CToken(dynamic jsonDict) : this((Dictionary<string, object>)jsonDict) { }
        public CToken(Dictionary<string, object> d) : base(d)
        {
            AccessToken = AsStr("access_token");
            ExpiresInSecs = AsInt("expires_in");
            MachineId = AsStr("machine_id");
            Expires = DateTime.Now.AddSeconds(ExpiresInSecs);
        }
    }
}
